package com.quarkus.cloud.config;

import io.smallrye.common.annotation.Identifier;
import io.vertx.rabbitmq.RabbitMQOptions;
import jakarta.ws.rs.Produces;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhuhb-a#glodon.con
 * @Description 描述
 * @date 2024/4/3017:19
 */
@Configuration
public class MqConfig {
    @Produces
    @Identifier("rabbitMQOptions")
    @Bean
    public RabbitMQOptions rabbitMQOptions() {
        return new RabbitMQOptions().setSsl(false)
                .setUser("admin")
                .setPassword("admin")
                .setHost("localhost")
                .setPort(5672)
                .setVirtualHost("/")
                // in milliseconds
                .setConnectionTimeout(6000)
                // in seconds
                .setRequestedHeartbeat(60)
                // in milliseconds
                .setHandshakeTimeout(6000).setRequestedChannelMax(5)
                // in milliseconds
                .setNetworkRecoveryInterval(500).setAutomaticRecoveryEnabled(true);
    }
}
